package com.ztc.common;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

import com.ztc.util.GlobalUtil;

public class ApplicationStartup implements ApplicationListener<ContextRefreshedEvent> {
	private Logger logger = Logger.getLogger(ApplicationStartup.class);

	@Override
	public void onApplicationEvent(ContextRefreshedEvent arg0) {
		logger.info("系统参数初始化中....");
		try {
			InputStream inputStream = ApplicationStartup.class.getResourceAsStream("/config.properties");
			Properties properties = new Properties();
			properties.load(inputStream);
			GlobalUtil.setProperties(properties);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
